from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

from index.basic_db_ops import delete_all_virtual_scene
from index.basic_db_ops2 import delete_all_scene_bs_element, delete_all_scene_user_element
from index.db_info import *

# try:
engine = create_engine(f'postgresql://{user_name}:{password}@localhost:5432/{db_name}', echo=False)
Session = sessionmaker(bind=engine)  # 生成 Session 类，在这个数据库操作之中，只需要Session类就可以，实例化的对象在各个函数当中
print(f"已经成功连接到本地的数据库{db_name}")
# except Exception as e:
#     print(f"数据库连接错误，原因是{str(e)}")

delete_all_scene_bs_element(Session)
delete_all_scene_user_element(Session)

print("Hello")